package cn.service.impl;

import cn.dao.UserDao;
import cn.dao.impl.UserDaoimpl;
import cn.domain.User;
import cn.service.Userservice;

import java.util.List;

public  class UserServiceImpl implements Userservice {
    private UserDao dao=new UserDaoimpl();

    public List<User> findAll() {
        return dao.findAll();
    }

    @Override
    public User finone() {
        return null;
    }
    public User FindUserByUsernameAndPassword(User user){
        return dao.FindUserByUsernameAndPassword(user.getUsername(), user.getPassword());

    }

    @Override
    public void addUser(User user) {
        dao.addUser(user);
    }

    @Override
    public void deleteUser(String id) {
        dao.deleteUser(Integer.parseInt(id));
    }

    @Override
    public User findUserByid(String id) {
        return dao.findUserByid(Integer.parseInt(id));
    }

    @Override
    public void updateUser(User user) {
        dao.updateUser(user);
    }
}
